package com.myth.process;

//测试插队代码
public class JoinTest implements Runnable{
    private int a = 0;

    //强制执行，插队
    @Override
    public void run() {
        for (int i = 0; i < 500; i++,a++) {
            if (Thread.currentThread().getName().equals("vip客户来了")){
                JoinTest.vip();
            }
            System.out.println("vip客户来了"+i);
        }
    }
    public static void vip(){

    }




    public static void main(String[] args) throws InterruptedException {
        JoinTest t = new JoinTest();
        Thread tt1 = new Thread(t,"普通客户");
        Thread tt2 = new Thread(t,"vip客户");
        tt1.start();
        tt2.start();
        for (int i = 0; i < 400; i++) {
            if (i == 200) {
                tt1.join();
                tt2.join();

            }
        }

    }
}
